<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm" enctype="multipart/form-data">
							<div class="form-group">
								<label class="col-sm-3 control-label">环节类型：</label>
								<div class="col-sm-8">
									<label class="radio-inline">
										<input type="radio" name="type" value="0" /> 一级环节
									</label>
									<label class="radio-inline">
										<input type="radio" name="type" value="1" /> 二级环节
									</label>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">上级环节：</label>
								<div class="col-sm-8">
									<select id="parentId" name="parentId" class="form-control">
                                        <!--<option value="0">根环节</option>-->
									</select>
									<!--<input id="" name="" class="form-control" type="text"
										   th:value="${pName}" readonly>-->
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">溯源环节名称：</label>
								<div class="col-sm-8">
									<input id="procedureLinkName" name="procedureLinkName" class="form-control" type="text">
								</div>
							</div>

							<!--<div class="form-group">-->
								<!--<label class="col-sm-3 control-label">默认值：</label>-->
								<!--<div class="col-sm-8">-->
									<!--<input id="defaultValue" name="defaultValue" class="form-control" type="text">-->
								<!--</div>-->
							<!--</div>-->

														                                                                <div style="display:none;" class="form-group">
								<label class="col-sm-3 control-label">图标：</label>
								<div class="col-sm-8">
									<input id="iconFile" name="iconFile" class="form-control" type="file">
								</div>
							</div>

														                                                                <div class="form-group">	
								<label class="col-sm-3 control-label">排序：</label>
								<div class="col-sm-8">
									<input id="sort" name="sort" class="form-control"  placeholder="数值越小越靠前" type="text">
								</div>
							</div>
														            <!--                                                    <div class="form-group">
								<label class="col-sm-3 control-label">是否显示查询：</label>
								<div class="col-sm-8">
									<select id="isView" name="isView" class="form-control">
										<option value="1">是</option>
										<option value="0">否</option>
									</select>
								</div>
							</div>-->
							<div style="display: none" id="rep" class="form-group">
								<label class="col-sm-3 control-label">是否可重复录入：</label>
								<div class="col-sm-8">
									<select id="isRepeat" name="isRepeat" class="form-control">
										<option value="1">是</option>
										<option value="0" selected>否</option>
									</select>
								</div>
							</div>
							<input id="proceduresId" name="proceduresId" th:value="${proceduresId}" type="hidden">
																					<div class="form-group">
								<div class="col-sm-8 col-sm-offset-3">
									<button type="submit" class="btn btn-primary">提交</button>
									<input type="button" class="btn btn-danger" value="取消"
										   onclick="javascript:
											var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
				                            parent.layer.close(index);">
									</input>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
	</div>
	</div>
	<div th:include="include::footer"></div>
	<script type="text/javascript">
		$('input[name="type"]').change(function () {
			if ($('input[name="type"][value="0"]').prop("checked")) {
                $("#parentId").empty();
				$("#parentId").append(new Option("根目录", 0 , false, true));
				$("#rep").fadeOut();
			}else {
				$("#parentId").empty();
				var url = ctx + "/procedures/procedureLink/first/"+$("#proceduresId").val();
				$.get(url,{},function (data) {
					$.each(data,function(index,val){
						$("#parentId").append(new Option(val.procedureLinkName, val.procedureLinkId, false, true));
					});
				});
				$("#rep").fadeIn();
				/*$("#parentId").append(new Option("多条数据", 1 , false, true))*/
			}
		})

	</script>


	<script type="text/javascript" th:src="@{/js/appjs/procedures/procedureLink/add.js}" src="/js/appjs/procedures/procedureLink/add.js">
	</script>
</body>
</html>
